import base;
import Xlib.display;
import Xlib.X;
import Xlib.XK;
import Xlib.error;
import Xlib.ext.xtest;

class input(base.input):
	def __init__(self):
		self.display = Xlib.display.Display();
		self.screen = self.display.screen();
		self.root = self.screen.root;
	def warp(self,x,y):
		self.root.warp_pointer(x,y);
		self.display.sync();
	def press(self,button):
		Xlib.ext.xtest.fake_input(self.display,Xlib.X.ButtonPress,button+1);
		self.display.sync();
	def release(self,button):
		Xlib.ext.xtest.fake_input(self.display,Xlib.X.ButtonRelease,button+1);
		self.display.sync();
	def click(self,button):
		self.press(button);
		self.release(button);

class output(base.output):
	def __init__(self):
		self.display = Xlib.display.Display();
		self.screen = self.display.screen();
	def resolution(self):
		return (self.screen.width_in_pixels,self.screen.height_in_pixels);
